<!DOCTYPE html>
<html>
{% load staticfiles %}
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" >
	<title>{% block title %}模板标题{% endblock %}</title>
	<link rel="stylesheet" type="text/css" href="{% static '/css/reset.css' %}">
	<link rel="stylesheet" type="text/css" href="{% static '/css/animate.css' %}">
	<link rel="stylesheet" type="text/css" href="{% static '/css/style.css' %}">
    <script src="{% static '/js/plugins/queryCity/js/public.js' %}" type="text/javascript"></script>
    <script src="{% static '/js/jquery.min.js' %}" type="text/javascript"></script>
    <script src="{% static '/js/jquery-migrate-1.2.1.min.js' %}" type="text/javascript"></script>
    {% block customCss %}{% endblock %}
    {% block customJs %}{% endblock %}
    <script src="{% static '/js/selectUi.js' %}" type='text/javascript'></script>
    <script type="text/javascript" src="{% static '/js/plugins/laydate/laydate.js' %}"></script>
    <script src="{% static '/js/plugins/layer/layer.js' %}"></script>
    <script type="text/javascript" src="{% static '/js/plugins/jquery.raty.js' %}"></script>
    <script src="{% static '/js/unslider.js' %}" type="text/javascript"></script>
    <script src="{% static '/js/plugins/jquery.scrollLoading.js' %}"  type="text/javascript"></script>
    <script src="{% static '/js/deco-common.js' %}"  type="text/javascript"></script>
</head>
<body>

<section class="headerwrap headerwrap2">
<header>
    <div  class="header2 header">
        {% if request.user.is_authenticated %}
        <div class="top">
            <div class="wp">
                <div class="fl"><p>服务电话：<b>848045826</b></p></div>
                <div class="personal">
                    <dl class="user fr">
                        <dd>
    {% if request.user.nickName  %}{{ request.user.nickName }}{% else %}{{ request.user.email }}{% endif %}
                            <img class="down fr" src="{% static '/images/top_down.png' %}"/>
                        </dd>
                        <dt>
                            <img width="20" height="20" src="{{ MEDIA_URL }}{{ request.user.image }}"/>
                        </dt>
                    </dl>
                    <div class="userdetail">
                            <dl>
                                <dt>
                                    <img width="80" height="80" src="{{ MEDIA_URL }}{{ request.user.image }}"/>
                                </dt>
                                <dd>
                                    <h2>django</h2>
                                    <p>{{ request.user.username }}</p>
                                </dd>
                            </dl>
                            <div class="btn">
                                <a class="personcenter fl" href="userCenterInfo.html">进入个人中心</a>
                                <a class="fr" href="{% url 'users:logout' %}">退出</a>
                            </div>
                        </div>
                </div>
                <a href="usercenter-message.html">
                        <div class="msg-num">
                            <span id="MsgNum">{{ request.user.getUnReadMessages }}</span>
                        </div>
                    </a>
                </div>
        </div>
        {% else %}
        <div class="top">
            <div class="wp">
                <div class="fl"><p>服务电话：<b>848245826</b></p></div>
                <a style="color:white" class="fr registerbtn" href="{% url "users:register" %}">注册</a>
                <a style="color:white" class="fr loginbtn" href="{% url "users:login" %}">登录</a>
            </div>
        </div>
        {% endif %}
        <div class="middle companyheader">
            <div class="wp">
                <img class="fl" style="width: 112px;height: 103px" src="{% static '/images/imooc.png' %}"/>
                <div class="head fl">
                    <h1>慕课网
                        <img src="{% static '/images/authentication.png' %}"/>
                        <img src="{% static '/images/gold.png' %}"/>
                    </h1>
                    <p class="fl">
                        <span class="fl" style="margin-top:8px;color:#848484;">推荐指数：</span>
                        <span class="precision company-credit" data-star-scope="5.0"></span>
                        <span class="key">5.0</span>
                    </p>
                </div>
                <div class="btn fr collectionbtn  notlogin" data-favid="22" data-fav-type="1">
                    {% if hasFav %}取消收藏{% else %}收藏{% endif %}
                </div>
            </div>
        </div>
    </div>
</header>
</section>

<section>
<div class="wp">
    <ul  class="crumbs">
        <li><a href="{% url 'index' %}">首页</a>></li>
        <li><a href="{% url 'orgs:orgPage'%}">课程机构</a>></li>
        <li>{% block pagePath %}机构首页{% endblock %}</li>
    </ul>
</div>
</section>

<section>
    <div class="wp list personal_list comp">
        <div class="left">
            <ul>
                <li {% ifequal active 'orgHome' %}class="active2"{% endifequal %}>
                    <a href="{% url 'orgs:orgHome' org.id %}">机构首页</a>
                </li>
                <li {% ifequal active 'orgDesc' %}class="active2"{% endifequal %}>
                    <a href="{% url 'orgs:orgDesc' org.id %}">机构介绍</a>
                </li>
                <li {% ifequal active 'orgCource' %}class="active2"{% endifequal %}>
                    <a href="{% url 'orgs:orgCource' org.id %}">机构课程</a>
                </li>
                <li {% ifequal active 'orgTeacher' %}class="active2"{% endifequal %}>
                    <a href="{% url 'orgs:orgTeacher' org.id %}">机构讲师</a>
                </li>
            </ul>
        </div>
        {% block right %}.......{% endblock %}
    </div>
</section>

<section>
    <ul class="sidebar">
        <li class="qq">
            <a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=2023525077&site=qq&menu=yes"></a>
        </li>
        <li class="totop"></li>
    </ul>
</section>

<script type="text/javascript">
//收藏
function add_fav(current_elem, favId, favType){
    $.ajax({
        cache: false,
        async: true,
        type: "POST",
        url:"{% url 'operations:userFavorite' %}",
        data:{'favId':favId,'favType':favType},
        beforeSend:function(xhr,settings){
            xhr.setRequestHeader("X-CSRFToken","{{ csrf_token }}");
        },
        success: function(data){
            if(data.status == "success"){
                if(data.msg == "收藏成功"){
                    current_elem.text("取消收藏")
                }else{
                    current_elem.text("收藏")
                }
            }else{
                if(data.msg == "用户未登录"){
                    alert("您还没有登录,请先登录！")
                    window.location.href="{% url 'users:login' %}";
                }else{
                    alert(data.msg)
                }
            }
        }
    })
}

$(function(){
    $('.collectionbtn').on('click',function(){
        add_fav($(this),{{ org.id }},1);
    })
{#    var $precision = $('.precision'),#}
{#    score = $precision.attr('data-star-scope'),#}
{#    option =  {#}
{#                    half		: true,#}
{#                    path		: '{% static '/images/' %}',#}
{#                    precision	: true,#}
{#                    size		: 24,#}
{#                    starOff		: 'g_star.png',#}
{#                    starOn		: 'r_star.png',#}
{#                    starHalf	: 'h_star.png',#}
{#                    hints       : ['极差', '差', '一般', '好评', '非常满意'],#}
{#                    noRatedMsg  : '暂时还未获得评价！',#}
{#                    readOnly    : true,#}
{#                    score       : score#}
{#    };#}
{#    $precision.raty(option);#}
{#    $('.jsFavBtn').on('click', function(){#}
{#        var type = $(this).attr('data-fav-type');#}
{#        if(type == '1'){#}
{#            favPraise($(this), 'fav' ,1 , '收藏');#}
{##}
{#        }else if(type == '3'){#}
{#            favPraise($(this), 'fav' ,3 );#}
{##}
{#        }else if(type == '11'){#}
{#            favPraise($(this), 'pra', 1);#}
{##}
{#        }else if(type == '4'){#}
{#            favPraise($(this), 'fav' ,4 );#}
{##}
{#        }#}
{#    });#}
})
</script>


{#<script type="text/javascript">#}
{#$(function() {#}
{#    $('.recordbtn1').click(function(){#}
{#        $('.recordbox1').show();#}
{#    });#}
{#    $('.recordbtn2').click(function(){#}
{#        $('.recordbox2').show();#}
{#    });#}
{#    $('.imgslide').unslider({#}
{#        speed: 500,               //  The speed to animate each slide (in milliseconds)#}
{#        delay: 3000,              //  The delay between slide animations (in milliseconds)#}
{#        complete: function() {},  //  A function that gets called after every slide animation#}
{#        keys: true,               //  Enable keyboard (left, right) arrow shortcuts#}
{#        dots: true,               //  Display dot navigation#}
{#        fluid: false              //  Support responsive design. May break non-responsive designs#}
{#    });#}
{#    var unslider = $('.imgslide').unslider();#}
{#    $('.unslider-arrow').click(function() {#}
{#        var fn = this.className.split(' ')[1];#}
{#        unslider.data('unslider')[fn]();#}
{#    });#}
{#);#}
{#</script>#}

</body>
</html>
